package object_;

import java.io.*;

public class Test3 {
    public static void main(String[] args) {
        String path="D:\\javacode\\javacode\\IO_1\\happy.txt";
        BufferedReader bufferedReader=null;
        try {
            bufferedReader=new BufferedReader(new InputStreamReader(new FileInputStream(path)));
            //将InputStream转换为Read，再用包装流BufferedReader处理
            String data=null;
            while((data=bufferedReader.readLine())!=null){
                System.out.println(data);
            }

        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                if(bufferedReader!=null) {
                    bufferedReader.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
